/* ** Connection ** */
+/*
+** Invoked when the backend is finally 'ready' (and has told produced
+** the details about the physical device - #sectors, size, etc).
+*/
static void connect(struct blkfront_info *info)
{
unsigned long sectors, sector_size;
return;
}
- info->connected = BLKIF_STATE_CONNECTED;
xlvbd_add(sectors, info->vdevice, binfo, sector_size, info);
-
- err = xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected);
- if (err)
- return;
+
+ (void)xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected);
/* Kick pending requests. */
spin_lock_irq(&blkif_io_lock);
+ info->connected = BLKIF_STATE_CONNECTED;
kick_pending_request_queues(info);
spin_unlock_irq(&blkif_io_lock);
}
-
/**
* Handle the change of state of the backend to Closing. We must delete our
* device-layer structures now, to ensure that writes are flushed through to
kfree(copy);
- /* Kicks things back into life. */
+ (void)xenbus_switch_state(info->xbdev, NULL, XenbusStateConnected);
+
+ /* Now safe for us to use the shared ring */
+ spin_lock_irq(&blkif_io_lock);
+ info->connected = BLKIF_STATE_CONNECTED;
+ spin_unlock_irq(&blkif_io_lock);
+
+ /* Send off requeued requests */
flush_requests(info);
- /* Now safe to let other people use the interface. */
- info->connected = BLKIF_STATE_CONNECTED;
+ /* Kick any other new requests queued since we resumed */
+ spin_lock_irq(&blkif_io_lock);
+ kick_pending_request_queues(info);
+ spin_unlock_irq(&blkif_io_lock);
}